package com.green.model.manage.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 员工状态
 * @author 
 */
public enum EmpTypeStatusEnum {
	TRAIL("试用",0),
	FORMAL("正式",1);
	private EmpTypeStatusEnum(String name, int value) {
		this.name = name;
		this.value = value; 
	}
	private String name;
	private int value;
	
	public String getName() {
		return name;
	}
	public int getValue() {
		return value;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setValue(int value) {
		this.value = value;
	}
	public static EmpTypeStatusEnum nameOf(String name){
		EmpTypeStatusEnum en = null;
		EmpTypeStatusEnum[] ary = EmpTypeStatusEnum.values();
		for(int i=0;i<ary.length;i++){
			if(ary[i].getName().equals(name)){
				en = ary[i];
			}
		}
		return en;
	}
	//得到list
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static List toList(){
		EmpTypeStatusEnum[] ary = EmpTypeStatusEnum.values();
		List type = new ArrayList();
		for(int i=0;i<ary.length;i++){
			Map<String,String> map = new HashMap<String,String>();
			map.put("value", ary[i].toString());
			map.put("name", ary[i].getName());
			type.add(map);
		}
		return type;
	}
}
